<template>
    <view class="square_components_ad_center">
        <z-paging ref="Zpaging" class="lis_div" v-model="list" @query="getList" :refresher-enabled="false" :fixed="false">
            <div class="lis_box">
                <div class="li" v-for="(li,key) in list" :key="key" @click="toDetail(li,key)">
                    <pub-image class="img" :src="li.coverImg" :mode="'aspectFill'"></pub-image>
                    <div class="bottom">
                        <pub-image class="icon" :src="'../../static/aimg/img_22.png'"></pub-image>
                        {{ li.seeNum }}
                    </div>
                </div>
            </div>
        </z-paging>
    </view>
</template>

<script>
export default {
    data() {
        return {
            list: [],
            isLoad: false,
        };
    },
    mounted() { },
    methods: {
        getZpagingList(type) {
            switch (type) {
                case 'init':
                    if (!this.isLoad) {
                        this.isLoad = true;
                        this.$comFun.openLoading();
                        this.$refs.Zpaging.reload();
                    }
                    break;
                case 'reload':
                    this.$refs.Zpaging.reload();
                    break;
                default:
                    break;
            }
        },
        async getList(pageNo, pageSize) {
            let data = {
                pageNo: pageNo,
                pageSize: pageSize,
            };
            const res = await this.$request.get('quan/getAdPage', data);
            this.$comFun.closeLoading();
            // console.log(res);
            if (res.code == 200) {
                this.$refs.Zpaging.complete(res.result.records);
            } else {
                this.$refs.Zpaging.complete(false);
            }
        },
        toDetail(info, key) {
            this.$comFun.openWin('/pages/square/ad_detail', {
                adId: info.id,
                // adDetailImg: info.detailImg
            });
            this.list[key].seeNum++;
        }
    },
};
</script>

<style lang="scss" scoped>
@import "@/common/css/square.scss";
</style>
